<?php
/**
 * view: task/index
 * @var CSService\Controller\Task
 * @var \Ke\Web\Context $this
 * @var \Ke\Web\Web     $web
 * @var string          $content
 */


$tasks = $this->tasks ?? [];
?>
<table class="ui table selectable compact">
	<thead>
	<tr>
		<th>id</th>
		<th>用户</th>
		<th>项目</th>
		<th>服务器</th>
		<th>命令</th>
		<th>状态</th>
		<th>开始时间</th>
		<th>完成时间</th>
	</tr>
	</thead>
	<tbody>
	<?php
	/** @var \CSService\Model\Task\Task $task */
	foreach ($tasks as $task) {
		?>
		<tr>
			<td><?php print $task->id ?></td>
			<td><?php print $task->user_name ?></td>
			<td><?php print $task->project_name; ?></td>
			<td><?php print $task->lan_ip; ?></td>
			<td><?php print $task->command_name; ?></td>
			<td><?php print ($task->status > 0 ? '完成' : '未完成'); ?></td>
			<td><?php print date('Y-m-d H:i:s', $task->created_at); ?></td>
			<td><?php print $task->completed_at > 0 ? date('Y-m-d H:i:s', $task->completed_at) : '-'; ?></td>
		</tr>
		<?php
	}
	?>
	</tbody>
</table>
<?php $this->component('pager', ['page' => $this->page, 'pageSize' => $this->pageSize, 'pageCount' => $this->pageCount]); ?>